package org.apache.james.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.james.core.Domain;
import org.apache.james.model.CustomDomain;

import java.util.List;

/**
 * 域名映射
 * @author ccoke
 */
public interface CustomDomainMapper {
    /**
     * 获取所有邮件域名
     */
    @Select("SELECT email_domain AS name FROM company GROUP BY email_domain")
    List<CustomDomain> selectList();

    /**
     * 获取域名数量
     */
    @Select("SELECT COUNT(*) FROM company WHERE email_domain = #{name}")
    int selectCountByName(@Param("name") String name);
}
